<template>
	<view class="u-page">
		<view class="fontTitle">{{helpType}}</view>
		<view class="u-demo-block" v-for="helpItem in helpItemList">
			<view class="u-demo-block__content">
				<view class="demo-layout bg-purple-light">
					<view class="content">
						<view class="itemName">{{helpItem.itemName}}</view>
						<view class="phone">联系电话</view>
						<view class="itemPhone" @click="callPhone(helpItem.itemPhone)">{{helpItem.itemPhone}}</view>
						<view class="phone">地址</view>
						<view class="propertyBox">
							<u-icon name="map" color="#2979ff" size="16"></u-icon>
							<text class="itemPhone" @click="goPage()">{{helpItem.itemPlace}}</text>
						</view>						
						<view class="phone">简介</view>
						<view>{{helpItem.itemBrief}}</view>
						<!-- <view>{{helpItem.itemPic}}</view> -->
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				helpItemList: [],
				helpType: ""
			}
		},
		onLoad(prop) {
			console.log(prop)
			this.helpType = this.convertType(prop.helpType);
			let that = this;
			uni.request({
				url: "/help/getbyhelptype?helpType=" + prop.helpType,
				success(res) {
					that.helpItemList = res.data.data
				}
			})
		},
		methods: {
			convertType(type) {
				let newType = ""
				if (type == "1") {
					newType = "小区民警"
				} else if (type == "2") {
					newType = "周边商铺"
				} else if (type == "3") {
					newType = "家政服务"
				} else if (type == "4") {
					newType = "政务电话"
				} else {
					newType = "出现错误"
				}
				return newType;
			},
			callPhone(phone) {
				uni.makePhoneCall({
					phoneNumber: phone.toString() //仅为示例 this.servicePhone是你要拨打的电话号码
				});
			},
			goPage(){
				uni.navigateTo({
					url:"map"
				})
			}
		}
	}
</script>

<style lang="scss">
	
	.propertyBox{
			flex-flow: row;
			justify-content: flex-start;
			display: flex;
		}
	.u-page {
		margin-top: 20rpx;
		margin-left: 20rpx;
		margin-right: 20rpx;
	}

	.fontTitle {
		margin-bottom: 10rpx;
		margin-left: 10rpx;
		margin-bottom: 40rpx;
		font-weight: 900;
		font-size: 60rpx;
		text-align: left;
	}

	.demo-layout {
		height: 180px;
		border-radius: 4px;
		margin-bottom: 20rpx;
	}

	.bg-purple {
		background: #ebf5ff;
	}

	.bg-purple-light {
		background: #e5e9f2;
	}

	.content {
		padding: 20rpx 15rpx 10rpx;
	}

	.itemName {
		font-weight: bold;
		font-size: 40rpx;
		margin-bottom: 15rpx;
		margin-top: 15rpx;
	}

	.phone {
		font-size: 25rpx;
		margin-bottom: 10rpx;
	}

	.itemPhone {
		color: #5555ff;
	}
</style>